package edu.suda.xsap.dto.convert;

import edu.suda.xsap.dto.LogDto;
import edu.suda.xsap.entity.Log;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

import java.util.List;

@Mapper(componentModel = "spring")
public interface LogConvert {

    @Mapping(source="loginName", target = "userName")
    @Mapping(source="clientIp", target = "ip")
    @Mapping(source="url", target = "requestUrl")
    @Mapping(source="method", target = "requestMethod")
    @Mapping(source="startTime", target = "beginTime" )
    @Mapping(source="costTime", target = "cost")

    LogDto toDto(Log log);

    List<LogDto> toDtoList(List<Log> logs);
}
